<?php 

class videoModel extends appModel
{
	public function get_video_list()
	{
        $prize_user = array();
        
        $sql = " SELECT thumb_url,avatar,id,title FROM ".$this->table("video")."  "
                ." WHERE 1 ORDER BY id ";
        
        $prize_user = $this->getAll($sql);
//         var_dump($prize_user);
        
        return $prize_user;
	}
	public function get_comment($id)
	{
	
		$sql = " (SELECT vc.wxid,vc.content,u.nickname,u.headimgurl FROM ".$this->table("video_comment")." as vc  "
				." LEFT JOIN ".$this->table("wxusers")." as u ON vc.wxid = u.wxid "
				." WHERE status=1 ORDER BY add_time DESC  LIMIT 15 ) UNION "
				." (SELECT vc.wxid,vc.content,u.nickname,u.headimgurl FROM ".$this->table("video_comment")." as vc  "
				." LEFT JOIN ".$this->table("wxusers")." as u ON vc.wxid = u.wxid "
				." WHERE vc.wxid = '".$_SESSION['wxid']."' ORDER BY add_time DESC ) ";
	
		$comment = $this->getAll($sql);
		//         var_dump($prize_user);
	
		return $comment;
	}
	public function get_video($id)
	{
		$prize_user = array();
	
		$sql = " SELECT video_url,id,title,avatar FROM ".$this->table("video")."  "
				." WHERE id = '".$id."'  ";
	
		$prize_user = $this->getRow($sql);
		//         var_dump($prize_user);
	
		return $prize_user;
	}
	
}

?>
